package indiwood.model.dao;

import indiwood.model.CinemaVO;
import indiwood.model.MovieVO;
import indiwood.model.ScheduleDateVO;
import indiwood.model.ScheduleTimeVO;
import indiwood.model.SeatVO;
import indiwood.model.ShowingVO;
import indiwood.model.TicketingVO;

import java.util.List;

import javax.annotation.Resource;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;
@Repository
public class TicketingDAOImpl implements TicketingDAO {
	@Resource(name="sqlSessionTemplate")
	private SqlSessionTemplate sqlSessionTemplate;
	@Override
	public List<MovieVO> getAllShowingTitle() {
		return sqlSessionTemplate.selectList("ticketing.getAllShowingTitle");
	}
	@Override
	public List<CinemaVO> getAllCinemaList() {
		return sqlSessionTemplate.selectList("ticketing.getAllCinemaList");
	}
	@Override
	public List<MovieVO> getAllShowingTitleByNo(int no) {
		return sqlSessionTemplate.selectList("ticketing.getAllShowingTitleByNo", no);
	}
	@Override
	public List<CinemaVO> getAllCinemaListByNo(int no) {
		return sqlSessionTemplate.selectList("ticketing.getAllCinemaListByNo", no);
	}
	@Override
	public ShowingVO getAllShowingByNo(ShowingVO showingVO) {
		return sqlSessionTemplate.selectOne("ticketing.getAllShowingByNo", showingVO);
	}
	@Override
	public MovieVO getMovieContentByNo(int movieNo) {
		return sqlSessionTemplate.selectOne("ticketing.getMovieContentByNo", movieNo);
	}
	@Override
	public List<ScheduleTimeVO> getShowingScheduleTimeByNo(ScheduleDateVO scheduleDateVO) {
		return sqlSessionTemplate.selectList("ticketing.getShowingScheduleTimeByNo", scheduleDateVO);
	}
	@Override
	public ScheduleTimeVO getAllOrderByTicketingNo(int ticketingNo) {
		return sqlSessionTemplate.selectOne("ticketing.getAllOrderListByTicketingNo", ticketingNo);
	}
	@Override
	public void writeTicketing(TicketingVO ticketingVO) {
		sqlSessionTemplate.insert("ticketing.writeTicketing", ticketingVO);
	}
	@Override
	public void writeSeat(SeatVO seatVO) {
		sqlSessionTemplate.insert("ticketing.writeSeat", seatVO);
	}
	@Override
	public List<TicketingVO> getTicketingListByEmail(String email) {
		return sqlSessionTemplate.selectList("ticketing.getTicketingListByEmail", email);
	}
	@Override
	public List<SeatVO> getSeatInfoList(int timeNo) {
		return sqlSessionTemplate.selectList("ticketing.getSeatInfoList", timeNo);
	}
}